public class Solution476 {
    public int findComplement(int num) {
        long t=1;
        while (t<=num){
            t=t*2;
        }
        return (int)t-num-1;
    }

    public static void main(String[] args) {
        System.out.println(new Solution476().findComplement(5));
    }
}
